<?php
/**
 * Created by PhpStorm.
 * User: Dave
 * Date: 2018/4/17
 * Time: 18:19
 */


ini_set('display_errors', 1);
error_reporting(-1);
require_once '/data/wwwroot/g_vendor/autoload.php';

use Biz\model\GoodsBasicInfo as mGoodsBasicInfo;
use Biz\cache\ShopRecommendPool as cShopRecommendPool;
use Biz\module\Packages\Recommend\RecommendGoods as sRecommendGoods;


/*
 *  商品池取多个末级分类对应的最新上架的商品
 *  每天更新一次
 *  TODO 增加缓存预热
 * **/
$result = mGoodsBasicInfo::getGoosdInfo();
try{

    if ($result){
        cShopRecommendPool::delGoods(sRecommendGoods::POOL_KEY);
        cShopRecommendPool::setGoods(sRecommendGoods::POOL_KEY, $result);
        echo printf("%s,%s",date('Y-m-d H:i:s'),'同步成功');
    } else {
        echo printf("%s,%s",date('Y-m-d H:i:s'),'当前没有需要同步的数据');
    }
}catch (\Exception $e){
    echo printf("出错,%s",$e->getMessage());
}





